package com.mybook.app.controller;

import com.mybook.app.core.BaseResponse;
import com.mybook.app.request.CollectPageRequest;
import com.mybook.app.request.CollectRequest;
import com.mybook.app.service.CollectService;
import com.mybook.app.utils.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by zjutsw on 2017/11/7.
 */
@RestController
@RequestMapping("collect")
public class CollectController {
    @Autowired
    private CollectService collectService;

    @PostMapping("add")
    public BaseResponse add(@RequestBody CollectRequest collectRequest) {
        Logger.debug(this, "添加更新任务");
        collectService.add(collectRequest);
        return BaseResponse.ok();
    }


    @PostMapping("list")
    public BaseResponse list(@RequestBody CollectPageRequest collectPageRequest) {
        Logger.debug(this, "获取收藏列表");
        return collectService.list(collectPageRequest);
    }


}
